<?php
require '../script/mysqlconfig.php';
$conn = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新建设备</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        body {
            position: relative;
        }

        td {
            text-align: right;
        }

        .select {
            top: 0;
            width: 100%;
            background-color: white;
        }
        .content {
            top: 50px;
            overflow: hidden;
            width: 100%;
            height: 100vh;
        }
        iframe {
            overflow: hidden;
            width: 100%;
            height: 100%;
            border: 0;
        }
    </style>
</head>
<body>
<div class="select">
    <form action="hostinsert2.php" method="post" enctype="multipart/form-data" target="dd3">
        <h4>设备信息</h4>
        <table border="0">
            <tr>
<!--                <td>设备品牌:<input type="text" name="brand"></td>-->
                <td>设备品牌:
                    <select name="brand">
                        <option value=0>------------请选择------------</option>
                        <?php
                        $sql= "select name from brand";
                        $result = $conn->query($sql);
                        while($row = $result->fetch_assoc())
                        {
                            echo "<option value='$row[name]'>$row[name]</option>";
                        }
                        ?>
                    </select>
                </td>
                <td>型号:<input type="text" name="model"></td>
                <td>序列号:<input type="text" name="serial_number"></td>
                <td> 设备类型:<select name="device_type">
                        <option value=0>------------请选择------------</option>
                        <?php
                        $sql= "select name from device_type";
                        $result = $conn->query($sql);
                        while($row = $result->fetch_assoc())
                        {
                            echo "<option value='$row[name]'>$row[name]</option>";
                        }
                        ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td>所在机房:<select name="room">
                        <option value=0>------------请选择------------</option>
                        <?php
                        $sql= "select name from room";
                        $result = $conn->query($sql);
                        while($row = $result->fetch_assoc())
                        {
                            echo "<option value='$row[name]'>$row[name]</option>";
                        }
                        ?>
                    </select>
                </td>
                <td>机柜:<input type="text" name="cabinet"></td>
                <td>开始U位:<input type="text" name="start_u"></td>
                <td>结束U位:<input type="text" name="end_u"></td>
            </tr>
            <tr>
                <td>设备使用状态:<select name="device_status">
                        <option value=0>------------请选择------------</option>
                        <?php
                        $sql= "select name from device_status";
                        $result = $conn->query($sql);
                        while($row = $result->fetch_assoc())
                        {
                            echo "<option value='$row[name]'>$row[name]</option>";
                        }
                        ?>
                    </select>
                </td>
                <td colspan="3">设备的用途:<input type="text" style="width: 718px;" name="device_feature"></td>
            </tr>
            <tr>
                <td>带外IP地址:<input type="text" name="bmc_ip"></td>
                <td>管理IP地址:<input type="text" name="manage_ip"></td>
                <td>业务IP地址:<input type="text" name="yewu_ip"></td>
            </tr>
            <tr>
                <td>设备归属:<select name="device_belong">
                        <option value=0>------------请选择------------</option>
                        <?php
                        $sql= "select name from device_belong";
                        $result = $conn->query($sql);
                        while($row = $result->fetch_assoc())
                        {
                            echo "<option value='$row[name]'>$row[name]</option>";
                        }
                        mysqli_close($conn);
                        ?>
                    </select>
                </td>
                <td>公司资产编码:<input type="text" name="asset_code"></td>
                <td>资产归属部门:<input type="text" name="belong_en"></td>
                <td>资产归属人员:<input type="text" name="belong_op"></td>
            </tr>
            <tr>
                <td>设备使用部门:<input type="text" name="use_en"></td>
                <td>设备使用人:<input type="text" name="use_operator"></td>
                <td>客户号:<input type="text" name="client_no"></td>
                <td>客户名字:<input type="text" name="client_name"></td>
            </tr>
            <tr>
                <td colspan="4">备注:<input type="text" style="width: 993px;" name="other"></td>
            </tr>
        </table>
        <input type="submit" value="保存设备信息">
    </form>
</div>
<div class="content">
    <iframe class="content-3" name="dd3"></iframe
</div>
</body>
</html>
